CDIBeanManagerJNDIDeployer{
  setStage(DeploymentStages.PRE_REAL);
}
internalDeploy{
  if (isSwitchYardDeployment(unit)) {
    unit.visit(new BinderVisitor());
}
internalUndeploy{
  if (isSwitchYardDeployment(unit)) {
    try {
      unit.visit(new UnbinderVisitor());
 catch (    DeploymentException e) {
}
isSwitchYardDeployment{
  return (unit.getClassLoader().getResource(AbstractDeployment.SWITCHYARD_XML) != null);
}
visit{
  if (unit.isTopLevel()) {
    Context javaComp=getJavaComp(unit);
      reference.add(new StringRefAddr("id",IdFactory.getIdFromClassLoader(unit.getClassLoader())));
      javaComp.bind("BeanManager",reference);
 catch (    NamingException e) {
}
error{
}
visit{
  if (unit.isTopLevel()) {
      Context javaComp=getJavaComp(unit);
      javaComp.unbind("BeanManager");
 catch (    NamingException e) {
}
error{
}
getJavaComp{
  Context javaComp=null;
  InitialContext initialContext=null;
  ClassLoader originalTCCL=Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(unit.getClassLoader());
    initialContext=new InitialContext();
    javaComp=(Context)initialContext.lookup("java:comp");
 catch (  Exception e) {
    try {
      if (initialContext != null) {
        try {
 catch (        NamingException e) {
      Thread.currentThread().setContextClassLoader(originalTCCL);
  return javaComp;
}
